using Blazored.LocalStorage;
using BlazorLearn.Shared.Data;
using BlazorLearn.Shared.Services;
using Microsoft.AspNetCore.Components.Authorization;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddMvc();
builder.Services.AddSwaggerDocument();

builder.Services.AddDbContext<ApplicationDbContext>();

builder.Services.AddBlazoredLocalStorage();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5196") });
builder.Services.AddTransient<IAuthenticationService, AuthenticationServiceProvider>();
builder.Services.AddTransient<AuthenticationStateProvider, AuthenticationServiceProvider>();


var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
}


app.UseStaticFiles();
app.UseRouting();
//app.UseAuthorization();

app.MapDefaultControllerRoute();
app.UseOpenApi().UseSwaggerUi3();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();




